// app.js
// 引入并执行utils工具文件
import './utils/utils'
// 引入并执行http.js文件
import './utils/http'
App({
  //-------------全局的数据-beigin-----------------
  token: '',
  refreshToken: '',
  //-------------全局的数据-end   -----------------
  onLaunch() {
    this.getToken()
    this.getRefreshToken()
  },
  getToken() {
    this.token = wx.getStorageSync('token')
  },
  getRefreshToken() {
    this.refreshToken = wx.getStorageSync('refreshToken')
  },
  setToken(token) {
    token = `Bearer ${token}`
    this.token = token
    wx.setStorageSync('token', token)
  },
  setRefreshToken(refreshToken) {
    refreshToken = `Bearer ${refreshToken}`
    this.refreshToken = refreshToken
    wx.setStorageSync('refreshToken', refreshToken)
  },
})
